<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>后台管理-用户中心首页</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
        <meta content="Coderthemes" name="author" />
        <!-- App favicon -->
        <link rel="shortcut icon" href="/public/assets/images/favicon.ico">

        <!-- third party css -->
        <link href="/public/assets/css/vendor/dataTables.bootstrap4.css" rel="stylesheet" type="text/css" />
        <link href="/public/assets/css/vendor/responsive.bootstrap4.css" rel="stylesheet" type="text/css" />
        <!-- third party css end -->
 <link rel="stylesheet" type="text/css" href="/public/static/index/layui/css/layui.css" />
        <!-- App css -->
        <link href="/public/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
        <link href="/public/assets/css/app.min.css" rel="stylesheet" type="text/css" />

    </head>

    <body>

        <!-- Begin page -->
        <div class="wrapper">

            <!-- ========== Left Sidebar Start ========== -->
          {include file="public/left" /}
            <!-- Left Sidebar End -->

            <!-- ============================================================== -->
            <!-- Start Page Content here -->
            <!-- ============================================================== -->

            <div class="content-page">
                <div class="content">

                    <!-- Topbar Start -->
                      {include file="public/top" /}
                    <!-- end Topbar -->

                    <!-- Start Content-->
                    <div class="container-fluid">
                        
                        <!-- start page title -->
                        <div class="row">
                            <div class="col-12">
                                <div class="page-title-box">
                                    <div class="page-title-right">
                                        <ol class="breadcrumb m-0">
                                            <li class="breadcrumb-item"><a href="{:url('/admin/index')}">后台首页</a></li>
                                            <li class="breadcrumb-item"><a href="{:url('/admin/content')}">商品管理</a></li>
                                            <li class="breadcrumb-item active">新增商品</li>
                                        </ol>
                                    </div>
                                    <h4 class="page-title">新增商品</h4>
                                </div>
                            </div>
                        </div>     
                        <!-- end page title --> 

                        <div class="row">
                            <div class="col-12">
                                <div class="card">
                                    <div class="card-body">
                                     
                                       

                                        <form action="" method="post">
                                              <div class="form-group">
                                                <label for="inputAddress2" class="col-form-label">标题</label>
                                                <input type="text" class="form-control" name="title" value="{$archivesData.title}">
                                            </div>  
                                       <div class="form-group">
                                                <label for="inputAddress2" class="col-form-label">付款标题</label>
                                                <input type="text" class="form-control" name="fukuantitle" value="{$archivesData.fukuantitle}">
                                            </div>  
                                             <div class="form-group">
                                                <label for="inputAddress2" class="col-form-label">下载地址</label>
                                                <input type="text" class="form-control" name="download" value="{$archivesData.download}">
                                            </div>  
                                             <div class="form-group">
                                                <label for="inputAddress2" class="col-form-label">安装教程</label>
                                                <input type="text" class="form-control" name="jiaochengid" value="{$archivesData.jiaochengid}">
                                            </div>  
                                             <div class="form-group">
                                                <label for="inputAddress2" class="col-form-label">下载密码</label>
                                                <input type="text" class="form-control" name="downloadpwd" value="{$archivesData.downloadpwd}">
                                            </div> 
                                                 <div class="form-group mb-3">
                                                        <label for="example-select">选择分组</label>
                                                        <select class="form-control" name="cate_id">
                                                    {volist name="cate" id="vo"}
                        <option value="{$vo.id}" {if condition="$cate_id eq $vo.id"}selected='selected'{/if}>{$vo.cate_name}</option>
        
                          {/volist}
                                                        </select>
                                                    </div>     
                                   <div class="form-group mb-3">
                                                        <label for="example-select">推荐等级</label>
                                                        <select class="form-control" name="states">
                          <option value="0" {if condition="$archivesData.states eq 0"}selected='selected'{/if}>不显示</option>
                          <option value="1" {if condition="$archivesData.states eq 1"}selected='selected'{/if}>显示</option>
                          <option value="2" {if condition="$archivesData.states eq 2"}selected='selected'{/if}>推荐</option>
                          <option value="3" {if condition="$archivesData.states eq 3"}selected='selected'{/if}>热门</option>
                          <option value="4" {if condition="$archivesData.states eq 4"}selected='selected'{/if}>最新</option>
                                                        </select>
                                                    </div>                         
                     <div class="layui-form-item">
                    <label class="layui-form-label">图片上传</label>
                    <div class="layui-input-block">
                      <button type="button" class="layui-btn" id="test1">
                        <i class="layui-icon">&#xe67c;</i>上传图片
                      </button>
                      <div class="public_thumb_box" {if condition="$archivesData['img']"}style="display:block"{/if} attr-model="archives">
                        <input type="text" name="img" value="{$archivesData.img}" class="public_thumb_input layui-input" style="width: 500px">
                        <img src="{$archivesData.img}" class="public_thumb" width="150">
                        <div class="delete_img"><i class="layui-icon layui-icon-delete"></i></div>
                      </div>

                    </div>
                  </div>
                                  
                                  
                     
                                  
                                             <div class="form-group">
                                                <label for="inputAddress2" class="col-form-label">源码价格</label>
                                                <input type="text" class="form-control" name="jiage" value="{$archivesData.jiage}">
                                            </div>  
                                          <div class="form-group">
                                                <label for="inputAddress2" class="col-form-label">搭建价格</label>
                                                <input type="text" class="form-control" name="ajjiage" value="{$archivesData.ajjiage}">
                                            </div>  
                                              <div class="form-group">
                                                <label for="inputAddress2" class="col-form-label">一条龙价格</label>
                                                <input type="text" class="form-control" name="ytljiage" value="{$archivesData.ytljiage}">
                                            </div>  
                                              <div class="form-group">
                                                <label for="inputAddress2" class="col-form-label">关键词</label>
                                                <input type="text" class="form-control" name="keywords" value="{$archivesData.keywords}">
                                            </div>  
                                              <div class="form-group">
                                                <label for="inputAddress2" class="col-form-label">描述</label>
                                                <input type="text" class="form-control" name="description" value="{$archivesData.description}">
                                            </div>  
                                        <div class="layui-form-item" >
              <label class="layui-form-label">详细内容</label>
              <div class="layui-input-block">
                <script id="editor" type="text/plain" name="content" style="width:100%;height:300px;">{$archivesData.content|raw}</script>
              </div>
            </div>

                                          

                                        

                                            <button type="submit" class="btn btn-primary">新增</button>

                                        </form>

                                    </div> <!-- end card-body -->
                                </div> <!-- end card-->
                            </div> <!-- end col -->
                        </div>
                        <!-- end row -->
                        
                    </div> <!-- container -->

                </div> <!-- content -->

                <!-- Footer Start -->
               {include file="public/foot" /}
                <!-- end Footer -->

            </div>

            <!-- ============================================================== -->
            <!-- End Page content -->
            <!-- ============================================================== -->


        </div>
        <!-- END wrapper -->


        <!-- Right Sidebar -->
        <div class="right-bar">

            <div class="rightbar-title">
                <a href="javascript:void(0);" class="right-bar-toggle float-right">
                    <i class="dripicons-cross noti-icon"></i>
                </a>
                <h5 class="m-0">Settings</h5>
            </div>

            <div class="slimscroll-menu rightbar-content">

                <!-- Settings -->
                <hr class="mt-0" />
                <h5 class="pl-3">Basic Settings</h5>
                <hr class="mb-0" />

                <div class="p-3">
                    <div class="custom-control custom-checkbox mb-2">
                        <input type="checkbox" class="custom-control-input" id="notifications-check" checked>
                        <label class="custom-control-label" for="notifications-check">Notifications</label>
                    </div>

                    <div class="custom-control custom-checkbox mb-2">
                        <input type="checkbox" class="custom-control-input" id="api-access-check">
                        <label class="custom-control-label" for="api-access-check">API Access</label>
                    </div>

                    <div class="custom-control custom-checkbox mb-2">
                        <input type="checkbox" class="custom-control-input" id="auto-updates-check" checked>
                        <label class="custom-control-label" for="auto-updates-check">Auto Updates</label>
                    </div>

                    <div class="custom-control custom-checkbox mb-2">
                        <input type="checkbox" class="custom-control-input" id="online-status-check" checked>
                        <label class="custom-control-label" for="online-status-check">Online Status</label>
                    </div>

                    <div class="custom-control custom-checkbox mb-2">
                        <input type="checkbox" class="custom-control-input" id="auto-payout-check">
                        <label class="custom-control-label" for="auto-payout-check">Auto Payout</label>
                    </div>

                </div>


                <!-- Timeline -->
                <hr class="mt-0" />
                <h5 class="pl-3">Recent Activity</h5>
                <hr class="mb-0" />
                <div class="pl-2 pr-2">
                    <div class="timeline-alt">
                        <div class="timeline-item">
                            <i class="mdi mdi-upload bg-info-lighten text-info timeline-icon"></i>
                            <div class="timeline-item-info">
                                <a href="#" class="text-info font-weight-bold mb-1 d-block">You sold an item</a>
                                <small>Paul Burgess just purchased “Hyper - Admin Dashboard”!</small>
                                <p class="mb-0 pb-2">
                                    <small class="text-muted">5 minutes ago</small>
                                </p>
                            </div>
                        </div>

                        <div class="timeline-item">
                            <i class="mdi mdi-airplane bg-primary-lighten text-primary timeline-icon"></i>
                            <div class="timeline-item-info">
                                <a href="#" class="text-primary font-weight-bold mb-1 d-block">Product on the Bootstrap Market</a>
                                <small>Dave Gamache added
                                    <span class="font-weight-bold">Admin Dashboard</span>
                                </small>
                                <p class="mb-0 pb-2">
                                    <small class="text-muted">30 minutes ago</small>
                                </p>
                            </div>
                        </div>

                        <div class="timeline-item">
                            <i class="mdi mdi-microphone bg-info-lighten text-info timeline-icon"></i>
                            <div class="timeline-item-info">
                                <a href="#" class="text-info font-weight-bold mb-1 d-block">Robert Delaney</a>
                                <small>Send you message
                                    <span class="font-weight-bold">"Are you there?"</span>
                                </small>
                                <p class="mb-0 pb-2">
                                    <small class="text-muted">2 hours ago</small>
                                </p>
                            </div>
                        </div>

                        <div class="timeline-item">
                            <i class="mdi mdi-upload bg-primary-lighten text-primary timeline-icon"></i>
                            <div class="timeline-item-info">
                                <a href="#" class="text-primary font-weight-bold mb-1 d-block">Audrey Tobey</a>
                                <small>Uploaded a photo
                                    <span class="font-weight-bold">"Error.jpg"</span>
                                </small>
                                <p class="mb-0 pb-2">
                                    <small class="text-muted">14 hours ago</small>
                                </p>
                            </div>
                        </div>

                        <div class="timeline-item">
                            <i class="mdi mdi-upload bg-info-lighten text-info timeline-icon"></i>
                            <div class="timeline-item-info">
                                <a href="#" class="text-info font-weight-bold mb-1 d-block">You sold an item</a>
                                <small>Paul Burgess just purchased “Hyper - Admin Dashboard”!</small>
                                <p class="mb-0 pb-2">
                                    <small class="text-muted">1 day ago</small>
                                </p>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>


        <div class="rightbar-overlay"></div>
        <!-- /Right-bar -->
           <script type="text/javascript" src="/public/static/admin2/ueditor/1.4.3/ueditor.config.js"></script>
    <script type="text/javascript" src="/public/static/admin2/ueditor/1.4.3/ueditor.all.min.js"> </script>
    <script type="text/javascript" src="/public/static/admin2/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
 <script type="text/javascript" src="/public/static/index/layui/layui.js"></script>
  <script>
    var ue = UE.getEditor('editor');
  </script>
    <script>
    /*-删除时候确认*/
    function public_del(url){
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.confirm('确认要删除吗？',function(index){
                window.location.href=url;
            });
        });
    }


    layui.use('upload', function () {
      var upload = layui.upload;

      //执行上传实例
      var uploadInst = upload.render({
        elem: '#test1' //绑定元素
        , url: '/admin/uploader/upload' //上传接口
        , done: function (res) {
          //上传完毕回调
          console.log(res);
          //path = JSON.stringify(res.path);
          //path = path.replace("\"", "").replace("\"", "");
          $(".public_thumb_input").val(res.path);
          $(".public_thumb").attr("src", res.path);
          $(".public_thumb_box").css("display", "block");
        }
        , error: function () {
          //请求异常回调
        }
      });
    });


    //实时删除图片
    $(".delete_img").click(function(){
        var path=$(this).parent().children(".public_thumb_input").val();
        var url="/admin/uploader/delete_img";
        var model = $(this).parent().attr('attr-model');//编辑默认删除图片
        var id=$("input[name='id']").val();//编辑默认删除图片
        postData = {'path':path,'model':model,'id':id};
        $.post(url,postData,function(result){
          result=JSON.parse(result);
          if(result.status==1){
            $(".public_thumb_input").val("");
            $(".public_thumb").attr("src", "");
            $(".public_thumb_box").css("display", "none");
            layui.use('layer', function(){
              var layer = layui.layer;
              layer.msg('已经删除成功！');
            }); 
          }
        });
    });

    //排序
    $('.listorder input').blur(function() {
    // 编写我们的抛送的逻辑
    //获取主键id
    var id = $(this).attr('attr-id');
    var model=$(this).attr('attr-model');
    // 获取排序的值
    var listorder = $(this).val();
    if(!listorder){
      return;
    }
    var postData = {

        'id' : id,
        'model':model,
        'listorder':listorder,
    };

    var url = "/admin/base/listorder";
    // 抛送http
    $.post(url, postData, function(result){
        // 逻辑
        if(result.code == 1) {
            location.href=result.data;
        }else {
            alert(result.msg);
        }
    },"json");


});

    </script>     <!-- App js -->
        <script src="/public/assets/js/app.min.js"></script>

        <!-- third party js -->
        <script src="/public/assets/js/vendor/jquery.dataTables.min.js"></script>
        <script src="/public/assets/js/vendor/dataTables.bootstrap4.js"></script>
        <script src="/public/assets/js/vendor/dataTables.responsive.min.js"></script>
        <script src="/public/assets/js/vendor/responsive.bootstrap4.min.js"></script>
        <script src="/public/assets/js/vendor/dataTables.checkboxes.min.js"></script>
        <!-- third party js ends -->

        <!-- demo app -->
        <script src="/public/assets/js/pages/demo.customers.js"></script>
        <!-- end demo js-->
 <script src="/public/assets/js/vendor/dropzone.min.js"></script>

    <!-- File upload js -->
    <script src="/public/assets/js/ui/component.fileupload.js"></script>
    </body>
</html>
